<%--
  Created by IntelliJ IDEA.
  User: HUAWEI
  Date: 2021/4/20
  Time: 10:16
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java"  %>

<html>
<head>
    <title>Title</title>
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery.js"></script>
    <script>
        $(function(){
            $("#get").click(function(){
                $.ajax({
                    url:"${pageContext.request.contextPath}/user/1?timer="+Math.random(),
                    type:"get",
                    success:function(data){
                        alert(data)
                    }
                })
            })

        })
    </script>
</head>
<body>


<button id="post">添加用户</button>
<button id="put">修改用户</button>
<button id="get">查询用户</button>
<button id="delete">删除用户</button>


<form action="${pageContext.request.contextPath}/user" method="post">
    <input type="hidden" name="_method" value="POST">
    <input type="text" name="username">
    <input type="text" name="password">
    <button>添加用户信息</button>
</form>

<a href="${pageContext.request.contextPath}/user/1">查询所有用户</a>


<form action="${pageContext.request.contextPath}/user/1" method="post">
    <input type="hidden" name="_method" value="DELETE">
    <button>删除用户信息</button>
</form>
<%--<a href="${pageContext.request.contextPath}/user/1">删除</a>--%>

</body>
</html>
